/**
 * Detail 	  layer弹出框
 * @author       SCC 
 * @copyright    noya.com 
 * @version      2015.7.29	1.0版
 */
window.layerdialog = new (function(json){
        var _self = this;
        this.init = function()
        {
        }
        this.showTab = function(cid,curl,ctitle)
        {
            window.parent!=window.self?window.parent.addTab( cid,curl,ctitle):window.location.href = curl;
        }
        this.closeTab = function()
        {
            window.parent!=window.self?window.parent.closeTab():window.history.go(-1);
        }
        this.showiframeDialog = function(url,config)
        {
            var defaults = {
                title:"弹出框",
                width:"500px",
                height:"680px"
            };
            for (var i in defaults) {
                    if (config[i] === undefined) config[i] = defaults[i];		
            };           
            return layer.open({
                type: 2,
                title: config.title,
                skin: 'layer-page1',
                area: [config.width, config.height],
                shadeClose: true, //点击遮罩关闭
                content: url
            });
        } 
        this.showdomDialog = function(obj,config)
        {
            var defaults = {
                title:"弹出框",
                width:"500px",
                height:"680px"
            };
            for (var i in defaults) {
                    if (config[i] === undefined) config[i] = defaults[i];		
            };                    
            return layer.open({
                type: 1,
                title: config.title,
                skin: 'layer-page1',
                area: [config.width, config.height],
                shadeClose: true, //点击遮罩关闭
                content: obj
            });
        }         
        this.closeiframeDialog = function()
        {
            parent.layer.close(parent.layer.getFrameIndex(window.name));
        }
        this.showSuccess = function(msg,end)
        {
            return layer.msg(msg,{icon: 1,time:3000,skin: 'layer-page1'},end);
        }
        this.showError = function(msg,end)
        {
            return layer.msg(msg,{icon: 2,time:3000,skin: 'layer-page1'},end);
        }
        this.showLoading = function(icon,time)
        {
            if(time == undefined) time = 5000;
            return layer.load(icon,{time:time,skin: 'layer-page1'});
        }
        this.showTips = function(content, follow, options){
            return layer.tips(content, follow, options);
        }
        this.closeDialog = function(index){
            layer.close(index); 
        }
        this.showPrompt = function(options, yes){
            layer.prompt(options,yes);
        }
        this.showConfirm = function(content, options, yes, cancel){
            layer.confirm(content, options, yes, cancel);
        }
        this.init();
})({});

